import 'package:enterprise_v6_app/app/core/core.dart';
import 'package:enterprise_v6_app/app/modules/task/task_all/education/me_demand_research/me_demand_research_detail/findings/findings_controller.dart';


///调研结果（调查问卷）
class FindingsPage extends StatelessWidget {
  FindingsPage({super.key});

  final controller = Get.put(FindingsController());
  @override
  Widget build(BuildContext context) {
    return GetBuilder(
        init: controller,
        builder: (_) {
          return Container(
            padding: EdgeInsets.only(left: 16.w, top: 14.w, right: 16.w, bottom: 14.w),
            child: Column(
              children: [
                _getDetailsView(),
                _divider(),
                Expanded(child: _geBottomView()),
                AppGaps.vGap20,
              ],
            ),
          );
        });
  }

  Widget _getDetailsView() {
    return Container(
      padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 20.w),
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.only(
          topRight: Radius.circular(6.w),
          topLeft: Radius.circular(6.w),
        ),
      ),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Row(
            mainAxisAlignment: MainAxisAlignment.start,
            children: [
              SvgPicture.asset(
                AppImages.icon_findings_result_select,
              ),
              AppGaps.hGap6,
              Text(
                '已选择专题',
                style: TextStyle(
                  fontSize: 16.sp,
                  color: const Color(0xFF262F38),
                  overflow: TextOverflow.ellipsis,
                  fontWeight: FontWeight.w400,
                ),
              ),
            ],
          ),
          AppGaps.vGap6,
          Wrap(
            // spacing: 47.w, // 主轴(水平)方向间距
            // runSpacing: 12.w, // 纵轴（垂直）方向间距
            children: controller.list
                .map(
                  (e) => Text(
                    e,
                    style: TextStyle(
                      fontSize: 14.sp,
                      color: const Color(0xFF495061),
                      overflow: TextOverflow.ellipsis,
                      fontWeight: FontWeight.w400,
                    ),
                  ),
                )
                .toList(),
          )
        ],
      ),
    );
  }

  Widget _geBottomView() {
    return Container(
      padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: 15.w),
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.only(
          bottomRight: Radius.circular(6.w),
          bottomLeft: Radius.circular(6.w),
        ),
      ),
      child: Column(
        children: [
          Row(
            mainAxisAlignment: MainAxisAlignment.start,
            children: [
              SvgPicture.asset(
                AppImages.icon_findings_recommendation,
              ),
              AppGaps.hGap6,
              Text(
                '建议',
                style: TextStyle(
                  fontSize: 16.sp,
                  color: const Color(0xFF262F38),
                  overflow: TextOverflow.ellipsis,
                  fontWeight: FontWeight.w400,
                ),
              ),
            ],
          ),
          AppGaps.vGap6,
          Expanded(
            child: Align(
              alignment: Alignment.topLeft,
              child: Text(
                '${controller.recommendation}',
                style: TextStyle(
                  fontSize: 14.sp,
                  color: const Color(0xFF262F38),
                  fontWeight: FontWeight.w400,
                ),
              ),
            ),
          ),
        ],
      ),
    );
  }


  ///分割线
  Widget _divider() {
    return Container(
      height: 0.5.w,
      decoration: const BoxDecoration(
          gradient: LinearGradient(begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [
        Color(0x33587DF5),
        Color(0x33587DF5),
        Color(0x33587DF5),
      ])),
    );
  }
}
